package cn.edu.scau.cmi.wuzhenxin.adapter;

import javafx.fxml.FXML;

import javafx.scene.control.Button;
import cn.edu.scau.cmi.wuzhenxin.abstractFactory.factory.AbstractFactory;
import cn.edu.scau.cmi.wuzhenxin.domain.Insure;
import javafx.event.ActionEvent;

import javafx.scene.control.TextArea;

import javafx.scene.layout.AnchorPane;

import javafx.scene.control.CheckBox;

import javafx.scene.control.ChoiceBox;

public class MyController {
	@FXML
	private AnchorPane InsureCom;
	@FXML
	private Button showbt;
	@FXML
	private TextArea detilText;
	@FXML
	private CheckBox adapterOfClass;
	@FXML
	private CheckBox adapterOfObject;

	@FXML
	public void eventButton(ActionEvent event) {
		Target adapter = null;
		if(adapterOfObject.isSelected()) {
			adapter = new AdapterOfObject();
		}else if(adapterOfClass.isSelected()) {
			adapter = new AdapterOfClass();
		}else {
			System.out.println("sorry, your input is not correct");
		}
		detilText.setText(adapter.doTarget());
	}
	
	public void choiceClass(ActionEvent event) {
		if(adapterOfClass.isSelected()) {
			adapterOfObject.setSelected(false);
		}else {
			adapterOfObject.setSelected(true);
		}
	}
	
	public void choiceObject(ActionEvent event) {
		if(adapterOfObject.isSelected()) {
			adapterOfClass.setSelected(false);
		}else {
			adapterOfClass.setSelected(true);
		}
	}
}